﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp20
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            int index = list.IndexOf("abc");
            if (index != 1)
            {
                Console.WriteLine("集合中存在abc元素");
            }
            else
            {
                Console.WriteLine("集合中不存在abc元素");
            }


            System.Collections.ArrayList lis = new System.Collections.ArrayList() { "abc", "bcd", "cde", 123, 456 };
            System.Collections.ArrayList newLis = new System.Collections.ArrayList();
            for (int i = 0; i < lis.Count; i = i + 1)
            {
                newLis.Add(lis[i]);
            }
            foreach (var a in newLis)
            {
                Console.WriteLine(a);
            }


            System.Collections.ArrayList li = new System.Collections.ArrayList() { "青悁", "澄翊", "斓絮", "訾翎", "窠筱" };
            System.Collections.ArrayList insertList = new System.Collections.ArrayList() { "氼", "刖", "杺" };
            li.InsertRange(5, insertList);
            foreach (var b in li)
            {
                Console.WriteLine(b);
            }


            System.Collections.ArrayList link = new System.Collections.ArrayList() { "逡巡", "踱步", "梦蝶" };
            link.Sort();
            foreach (var c in link)
            {
                Console.WriteLine(c);
            }


            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("A", "1");
            dic.Add("B", "2");
            dic.Add("C", "3");
            dic.Add("D", "4");
            StringBuilder str1 = new StringBuilder();
            var moment = dic.OrderBy(x => x.Key, new ComparerTest()).ToDictionary(x => x.Key, y => y.Value);
            foreach (string dic1 in moment.Keys)
            {
                str1.Append(dic1);
            }
            Console.WriteLine(str1.ToString());
            Console.ReadKey();

            
        }
    }
}
